home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10445 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  37 lines

  1. Path: hamlet.uncg.edu!q_zhong
  2. From: "QIAN . ZHONG" <q_zhong@hamlet.uncg.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: good delete questions
  5. Date: Wed, 6 Mar 1996 17:32:52 -0500
  6. Organization: The University of North Carolina at Greensboro
  7. Message-ID: <Pine.SOL.3.91.960306171540.26843A-100000@hamlet.uncg.edu>
  8. NNTP-Posting-Host: hamlet.uncg.edu
  9. Mime-Version: 1.0
  10. Content-Type: TEXT/PLAIN; charset=US-ASCII
  11.  
  12.  
  13. Hi, folks:
  14.  
  15. A couple questions about delete operator.
  16. 1. delete can be overrided, but not overloaded, any other operator does 
  17.    same thing ? I mean for global operator. Can free() be overrided ?
  18. 2. Check the simple code:
  19.    char *pc = new char;
  20.    char *pc2 = pc;
  21.    *pc = 'a';
  22.    delete pc;             // so far, everything is fine.
  23.    putchar(*pc2);         // I found pc2 still pointed to the same address
  24.                           // just like before delete, but value already
  25.                           // changed, does OS or compiler or whatever
  26.                           // did anything here ? why pointed 
  27.                           // value change, I know I should not 
  28.                           // use any released memory, I just 
  29.                           // want to know what is actully happening 
  30.                           // here ? For DOS, as I know
  31.                           // delete -call-> free -call ->bios,
  32.                           // then what ? 
  33.     
  34.  Please send me mail. Thanks                                  
  35.  
  36.  Qian
  37.